<html> <head> <title>Rubikon tutorial</title> </HEAD> <BODY bgColor="#babbe6" link="black" text="black" vLink="black"> <CENTER> <TABLE bgColor="#9698d6" border="0" cellPadding=1 width="99%"> <TBODY> <TR> <TD> <TABLE bgColor="#dcddf8" border="0" cellPadding="10" width="100%"> <TBODY> <TR> <TD style="CURSOR: default"> <FONT FACE="Verdana" size="2"> <h2> <img src=rubikonicon.gif align=left> A Simple Rubikon Tutorial </h2> <br> This tutorial assumes you're using an American Ruby ROM.<p> First, use your favorite hex editor to find some free space in your ROM. For this example, we'll assume the offset 0x800000.<p> Enter the following code in NotePad and save it as HelloWorld.RBC. <table border=0 cellspacing=10 cellpadding=10> <tr> <td bgcolor=#babbe6> <font face="Courier New" size=2> #org 0x800000<br> message 0x800100<br> boxset 0x02<br> end<br> #org 0x800100<br> = Hello World!<br> </font> </td> </tr> </table> Start Diamond Cutter, select your ROM from the dropdown list and doubleclick HelloWorld.RBC in the script list. Now we'll cover how to assign this code to a object in the game.<p> You'll need EliteMap now. Start EliteMap and load your ROM. Now, load the default map. In this example, it should be Littleroot. Find the person between the town sign and Birch's lab. If you ctrl-click this object, the script viewer will show you the following data: <table border=0 cellspacing=10 cellpadding=10> <tr> <td bgcolor=#babbe6> <font face="Courier New" size=2> '-----------------------<br> #org 0x14D6CD<br> msgbox 0x0 0x816AC00 '"If you use a PC, you can..."<br> boxset 0x2<br> end <br> <br> '---------<br> ' Strings<br> '---------<br> #org 0x816AC00<br> = If you use a PC, you can store items\nand<br> &nbsp;&nbsp;POKéMON.\pThe power of science is staggering!<br> </font> </td> </tr> </table> We'll use this person (who, by the way, is the fat guy) as our main victim. Close the script viewer and, in EliteMap, click the Objects tab. Here, click the People tab.<p> As you might have noticed in the map editor, Fat Guy's script is at 0x14D6CD and his index is 2. Therefore, set the scroll bar to 2 to see Fat Guy's settings. In the Script field, enter "&H800000" and press Tab.<p> Now, save this map and load your ROM in your favorite emulator. When you finally get the chance, talk to the fat guy and note how he no longer praises the power of science! Instead, he says "Hello World!"<p> If you ctrl-click the fat guy in EliteMap, the script viewer now shows a totally different script: <table border=0 cellspacing=10 cellpadding=10> <tr> <td bgcolor=#babbe6> <font face="Courier New" size=2> <b>ScriptEd</b><br> #org 0x800000<br> msgbox 0x0 0x8800100 '"Hello World!"<br> boxset 0x2<br> end <br> <br> #org 0x8800100<br> = Hello World!<br> </font> </td> <td bgcolor=#babbe6> <font face="Courier New" size=2> <b>RubiKode</b><br> #org 0x800000<br> message 0x800100<br> boxset 0x02<br> end<br> <br> #org 0x800100<br> = Hello World!<br> </font> </td> </tr> </table> As you can see, RubiKode and Bouché's disassemblies are <i>very</i> similar. It's so bad, if you know the commands, you can port disassemblies to RubiKode in mere minutes, like I did with the rich boy in front of the forest (richboy.rbc). That's why this release's command reference includes the command's bytecodes.<p> See, Rubikon's not that scary at all. Its creator is ;) <p> <b>A quick reminder -</b> To do an <i>if then else</i>, use <i>compare</i> and <i>if</i>:<br> <table border=0 cellspacing=10 cellpadding=10> <tr> <td bgcolor=#babbe6> <font face="Courier New" size=2> <b>BASIC</b><br> x = CheckGender()<br> if x = 0 then<br> &nbsp;&nbsp;goto Boy<br> else<br> &nbsp;&nbsp;goto Girl<br> end if<br> <br> Boy:<br> ... </font> </td> <td bgcolor=#babbe6> <font face="Courier New" size=2> <b>RubiKode</b><br> checkgender<br> compare LASTRESULT B_BOY<br> if B_TRUE C_BOY<br> compare LASTRESULT B_GIRL<br> if B_TRUE C_GIRL<br> break<br> <br> #org C_BOY<br> ... </font> </td> </tr> </table> <hr> <font size=1> Last updated: 16-11-04 </font> </FONT> </TD> </TR> </TBODY> </TABLE> </TD> </TR> </TBODY> </TABLE> </CENTER> </BODY> </HTML>